package com.erdos.upc.core;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.erdos.common.web.LoginUtil;



public class UpcUtil extends LoginUtil{
	
	private static final Log logger = LogFactory.getLog(UpcUtil.class);
	
	public static UpcUser getUpcUser(HttpServletRequest request){
		HttpSession session=request.getSession();
		UpcUser upcUser=(UpcUser)session.getAttribute(UpcConst.LOGIN_UPC_USER);
//		if(upcUser==null){
//			//手工默认创建一个UpcUser
//			upcUser=new UpcUser();
//			upcUser.setLoginId("DEV_TEST");
//			upcUser.setLoginTime(new Date());
//			upcUser.setName("test");
//			Privilege p1=new Privilege();
//			p1.setCode("p001");
//			upcUser.getPrivileges().add(p1);
//		}
//		logger.debug("upcUser id"+upcUser.getLoginId());
		return upcUser;
	}
	

}
